Skip to content

Clarify that Set-ItResult ends the It block (Pester v5 Skip section)#1857

Merged
aaronpowell merged 1 commit into
github:stagedfrom
tablackburn:pester-v5-setitresult-ends-block
May 28, 2026
Merged

Clarify that Set-ItResult ends the It block (Pester v5 Skip section)#1857
aaronpowell merged 1 commit into
github:stagedfrom
tablackburn:pester-v5-setitresult-ends-block

Conversation

@tablackburn
Copy link
Copy Markdown

Pull Request Checklist

  • I have read and followed the CONTRIBUTING.md guidelines.
  • I have read and followed the Guidance for submissions involving paid services.
  • My contribution adds a new instruction, prompt, agent, skill, or workflow file in the correct directory.
  • The file follows the required naming convention.
  • The content is clearly structured and follows the example format.
  • I have tested my instructions, prompt, agent, skill, or workflow with GitHub Copilot.
  • I have run npm start and verified that README.md is up to date.
  • I am targeting the staged branch for this pull request.

Description

Adds one bullet to the Skip section of instructions/powershell-pester-5.instructions.md
clarifying that Set-ItResult -Skipped/-Inconclusive ends the current It block:

  • Ends the test body: Set-ItResult -Skipped/-Inconclusive throws internally to end the
    It block, so code after it does not run; a trailing return is unreachable and should not be
    added

The existing "Runtime Skip" bullet notes that setup/teardown still run, but doesn't say the call
ends the current test body. Without that, it's a common mistake to add a return after
Set-ItResult — automated reviewers (including Copilot's PR reviewer) recurrently suggest it —
which is unreachable dead code.

This is verified by Pester's implementation: Set-ItResult ends in
throw [Pester.Factory]::CreateErrorRecord(...), which unwinds the It block for Pester to catch
and record as the result. Confirmed empirically on Pester 5.7.1: an It that calls
Set-ItResult -Skipped followed by throw reports Skipped, not Failed — the statement after
the skip never executes.


Type of Contribution

  • Update to existing instruction, prompt, agent, plugin, skill, or workflow.

Additional Notes

  • Docs-only, single-line addition; no frontmatter change.
  • npm start (update-readme + generate-marketplace) produces no diff to README.md or
    marketplace.json, since the change is in the file body rather than its title/description.
  • "Tested with GitHub Copilot" is left unchecked because this is a factual clarification of Pester's
    runtime behavior rather than a new Copilot-facing instruction; the claim is verified against
    Pester's source and runtime as described above.

By submitting this pull request, I confirm that my contribution abides by the Code of Conduct and
will be licensed under the MIT License.

Set-ItResult -Skipped/-Inconclusive throws internally to end the It block, so code after it does not run and a trailing return is unreachable. Documenting this prevents the recurring suggestion to add a redundant return after Set-ItResult.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 28, 2026 01:46
@tablackburn tablackburn requested a review from aaronpowell as a code owner May 28, 2026 01:46
@github-actions github-actions Bot added the instructions PR touches instructions label May 28, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🟡 Contributor Reputation Check: MEDIUM risk

Check Risk
Profile MEDIUM
Credential audit NONE

Maintainers: please review this contributor before merging.
See the workflow run for full details.
Automated check powered by AGT.

@github-actions github-actions Bot added the needs-review:MEDIUM Contributor reputation check flagged MEDIUM risk label May 28, 2026
@aaronpowell aaronpowell merged commit 70209f3 into github:staged May 28, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

instructions PR touches instructions needs-review:MEDIUM Contributor reputation check flagged MEDIUM risk

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants